
fetch('http://chst.vip:1234/api/getindexmenu')
.then(body=>body.json())
.then(res=>{

    // ./../pages/
    let arr = [
        './../pages/category.html','./../pages/moneyctrl.html','./../pages/inlanddiscount.html','./../pages/baicaijia.html',
'./../pages/moneyctrl.html','./../pages/coupon.html','./../pages/category.html','',
'./../pages/gsproduct.html','./../pages/category.html','./../pages/sitenav.html','./../pages/brandTitle.html'
]
    Array.from($("#menu div p")).forEach((p,index) => {
        let falg = true
        p.innerText = res.result[index].name
        $("#menu div").eq(index).click(function(){
            console.log(index);
            if(index!==7){
                location.href = arr[index]
            }else{
                falg =!falg
                if(falg){
                    $(".divv").stop().animate({height:$(".divv").width()})
                }else{
                      $(".divv").stop().animate({height:0,padding:0},500)
                }

            }
            
        })
      
    });
    
})
fetch('http://chst.vip:1234/api/getmoneyctrl')
.then(body=>body.json())
.then(res=>{
    // console.log(res);
    let html = ''
    res.result.forEach(item=>{
        html +=`<li productId = ${item.productId}>
        ${item.productImg2}
        <p>
        <span>${item.productName} <span>${item.productPinkage}</span></span>
        <span>${item.productFrom}|${item.productTime}<span><span class='iconfont icon-biaoqing'></span>${item.productComCount}</span></span>
        </p>
        </li>` 
    })
    $('#uu')[0].innerHTML = html
    Array.from($('#uu>li')).forEach(li=>{
        li.onclick = function(){
            let index = this.getAttribute('productId')
            console.log(index);
            location.href = './discount.html?productid='+index
        }
    })
    
})

